package com.example.lib_core.mvp.view;

import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;

import com.blankj.utilcode.util.ToastUtils;
import com.example.lib_core.R;
import com.example.lib_core.mvp.presenter.IPresenter;

import javax.inject.Inject;

public abstract class BaseActivity<P extends IPresenter> extends AppCompatActivity implements IActivity,IView {

    @Inject
    protected P mPresenter;

    private Dialog dialog;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(bondLayout());
        Inject();
//        getLifecycle().addObserver(mPresenter);
        initView();
        initData();
    }

    @Override
    public void showDialog() {
        dialog=new Dialog(this,R.style.FullScreenDialog);
        View inflate = LayoutInflater.from(this).inflate(R.layout.pop, null);
        dialog.setContentView(inflate);
        dialog.show();
    }

    @Override
    public void hideDialog() {
        dialog.dismiss();
    }

    @Override
    public void showToast(String msg) {
        ToastUtils.showShort(msg);

    }
}
